package com.hugang.principle.segregation;

interface Interface2 {
    void test1();
}

interface Interfade3 {
    void test2();

    void test3();
}

interface Interfade4 {
    void test4();

    void test5();
}

class D2 implements Interface2, Interfade4 {

    @Override
    public void test1() {
        System.out.println("D --> test1");
    }

    @Override
    public void test4() {
        System.out.println("D --> test4");

    }

    @Override
    public void test5() {
        System.out.println("B --> test5");

    }
}

class B2 implements Interface2, Interfade3 {

    @Override
    public void test1() {
        System.out.println("B --> test1");
    }

    @Override
    public void test2() {
        System.out.println("B --> test2");

    }

    @Override
    public void test3() {
        System.out.println("B --> test3");

    }

}

class A2 {
    B2 b = new B2();

    public void test1() {
        b.test1();
    }

    public void test2() {
        b.test2();
    }

    public void test3() {
        b.test3();
    }

}

class C2 {
    D2 d = new D2();

    public void test1() {
        d.test1();
    }

    public void test4() {
        d.test4();
    }

    public void test5() {
        d.test5();
    }

}

/**
 * 将接口拆分为多个接口之后，A类和C类依赖的B、D类都只是实现了需要实现的相关接口，符合接口隔离原则。
 *
 * @author hg
 * @date 2020/9/6 16:53
 */
public class SegregationDemo2 {
}
